<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增鉴定')" />
    <th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-appraisal-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label">协议类型：</label>
                <div class="col-sm-8">
                    <select name="protocolType" class="form-control m-b" th:with="type=${@dict.getType('protocol_type')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">鉴定类型：</label>
                <div class="col-sm-8">
                    <select name="appraisalType" class="form-control m-b" th:with="type=${@dict.getType('appraisal_type')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">项目类型：</label>
                <div class="col-sm-8">
                    <select name="projectType" class="form-control m-b" th:with="type=${@dict.getType('project_type')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">成果名称：</label>
                <div class="col-sm-8">
                    <input name="appraisalName" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">组织鉴定/验收单位：</label>
                <div class="col-sm-8">
                    <input name="appraisalDept" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">鉴定水平或验收等级：</label>
                <div class="col-sm-8">
                    <select name="appraisalLevel" class="form-control m-b" th:with="type=${@dict.getType('appraisal_level')}">
                        <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">主要完成人：</label>
                <div class="col-sm-8">
                    <textarea name="mainCompletedMan" class="form-control"></textarea>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">鉴定/验收时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="appraisalTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
                    </div>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">申报时间：</label>
                <div class="col-sm-8">
                    <div class="input-group date">
                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        <input name="reportTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">单位：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <select name="reportUnitId" id="reportUnitId" class="form-control m-b"
                                th:with="type=${@dept.getUnit()}">
                            <option value="">-选择部门-</option>
                            <option th:each="dict : ${type}" th:text="${dict.deptName}" th:value="${dict.deptId}"></option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">科室：</label>
                <div class="col-sm-8">
                    <div class="input-group">
                        <select name="departmentId"  id="departmentId" class="form-control m-b" >
                            <option value="">-选择科室-</option>
                        </select>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
        var prefix = ctx + "system/appraisal"
        $("#form-appraisal-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-appraisal-add').serialize());
            }
        }

        $("input[name='appraisalTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='reportTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='gmtTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
        $("#reportUnitId").change(function () {
            var t = $("#reportUnitId").val();
            if (t == '') {
                return;
            }

            $.ajax({
                url: ctx + 'system/dept/getDept',
                async: false,
                type: 'get',
                data: {unit: t},
                success: function (data) {
                    var t3 = $("#departmentId").empty();
                    for (var i = 0; i < data.length; i++) {
                        t3.append("<option value='" + data[i].deptId + "'>" + data[i].deptName + "</option>");
                    }
                }
            })
        });
    </script>
</body>
</html>